﻿<UserControl x:Class="IpControlsWpf.IPv4TextBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="23" Width="110"
    BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" BorderThickness="1"
    Style="{DynamicResource style_uC}"
    SnapsToDevicePixels="True">
    <UserControl.Resources>
        <Style TargetType="UserControl" x:Key="style_uC">
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="True">
                    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="Label" x:Key="style_lbl">
            <Style.Setters>
                <Setter Property="HorizontalAlignment" Value="Left" />
                <Setter Property="Panel.ZIndex" Value="50" />
                <Setter Property="VerticalAlignment" Value="Top" />
            </Style.Setters>
        </Style>
        <Style TargetType="TextBox" x:Key="style_tB">
            <Style.Setters>
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="HorizontalAlignment" Value="Left" />
                <Setter Property="MaxLength" Value="3" />
                <Setter Property="MaxLines" Value="1" />
                <Setter Property="Panel.ZIndex" Value="10" />
                <Setter Property="VerticalAlignment" Value="Stretch" />
                <Setter Property="VerticalContentAlignment" Value="Center" />
                <Setter Property="Width" Value="30" />
            </Style.Setters>
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="True">
                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Label Name="lbl_Sep0" Margin="21,-2,0,0" Style="{DynamicResource style_lbl}">.</Label>
        <Label Name="lbl_Sep1" Margin="47,-2,0,0" Style="{DynamicResource style_lbl}">.</Label>
        <Label Name="lbl_Sep2" Margin="73,-2,0,0" Style="{DynamicResource style_lbl}">.</Label>
        <TextBox Name="tB_Octet0" HorizontalContentAlignment="Center" Margin="0,0,0,0" Style="{DynamicResource style_tB}" GotFocus="tB_Octet_GotFocus" LostFocus="tB_Octet_LostFocus" TextChanged="tB_Octet_TextChanged" PreviewKeyDown="tB_Octet_PreviewKeyDown" PreviewTextInput="tB_Octet_PreviewTextInput">0</TextBox>
        <TextBox Name="tB_Octet1" HorizontalContentAlignment="Center" Margin="26,0,0,0" Style="{DynamicResource style_tB}" GotFocus="tB_Octet_GotFocus" LostFocus="tB_Octet_LostFocus" TextChanged="tB_Octet_TextChanged" PreviewKeyDown="tB_Octet_PreviewKeyDown" PreviewTextInput="tB_Octet_PreviewTextInput">0</TextBox>
        <TextBox Name="tB_Octet2" HorizontalContentAlignment="Center" Margin="52,0,0,0" Style="{DynamicResource style_tB}" GotFocus="tB_Octet_GotFocus" LostFocus="tB_Octet_LostFocus" TextChanged="tB_Octet_TextChanged" PreviewKeyDown="tB_Octet_PreviewKeyDown" PreviewTextInput="tB_Octet_PreviewTextInput">0</TextBox>
        <TextBox Name="tB_Octet3" HorizontalContentAlignment="Center" Margin="78,0,0,0" Style="{DynamicResource style_tB}" GotFocus="tB_Octet_GotFocus" LostFocus="tB_Octet_LostFocus" TextChanged="tB_Octet_TextChanged" PreviewKeyDown="tB_Octet_PreviewKeyDown" PreviewTextInput="tB_Octet_PreviewTextInput">0</TextBox>
    </Grid>
</UserControl>